// 导入 express 模块
const express = require("express");
// 导入cors并配置cros中间件
const cors = require("cors");
// const userRouter = require("./router/user");
const loginRouter = require("./router/user/controller/login");
const shoppingCar = require("./router/user/controller/shoppingCar");
const app = express();

app.use(cors());

// 引入数据库  链接数据库
require("./db/index");

// 配置解析application x-www-form-urlencoded 模式的表单数据 的中间件
app.use(express.urlencoded({ extended: false }));

app.use(express.json());
// 导入并注册路由模块

// app.use("/api", userRouter);
app.use("/only", loginRouter);
app.use("/only", shoppingCar);

// 启动 nodemon ./bin/www
module.exports = app;